let fetch = require("node-fetch")
let Headers = fetch.Headers
// let helper = require("../app/extend/helper")
// let cookies = []
function getIp1(ip) {
	let meta = {
		"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"Accept-language": "zh-CN,zh;q=0.9", "cache-control": "no-cache", "pragma": "no-cache",
		"Upgrade-insecure-requests": "1",
		"User-Agent": " Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
		"Cookie": "__jsluid=69e27f78e5824fb0586c28a17b12d772",
		"ReferrerPolicy": "no-referrer-when-downgrade",
	}
	return fetch("http://freeapi.ipip.net/" + ip, {
		timeout: 6000,
		"headers": new Headers(meta),

		"method": "GET",
		"mode": "cors"
	}).then(async (v) => {
		// v.headers.get()
		try {
			let arr = await v.json()
			console.log(arr)
			if (Array.isArray(arr))
				return arr
		} catch (error) {
			console.log("网络发生错误")
			return
		}
	})
}

module.exports = getIp1
getIp1("116.22.132.168").then(console.log)